// =================================================================
// File: File.h
// Desc: Contains File class with basic accessor functions
// =================================================================

#ifndef FILE_H
#define FILE_H

// =================================================================
// INCLUDES
// =================================================================

#include "Inode.h"

// =================================================================
// CLASSES
// =================================================================

// =================================================================
// Name: File
// Desc: Stores file information when a file has been opened
// =================================================================
class File
{

    public:
        File(int fd, int inode_index, int mode, int seek_offset);
        File();
        ~File();

        void SetFd(int fd) {
            this->fd = fd;
        }
        void SetInodeIndex(int inode_index) {
            this->inode_index = inode_index;
        }
        int GetMode() {
            return mode;
        }
        void SetMode(int mode) {
            this->mode = mode;
        }
        void SetSeekOffset(int seek_offset) {
            this->seek_offset = seek_offset;
        }
        int GetFd() const {
            return fd;
        }
        int GetInodeIndex() {
            return inode_index;
        }
        int GetSeekOffset() const {
            return seek_offset;
        }

    protected:
        int fd;	            // File descriptor created by open
        int inode_index;    // An index to array of inodes
        int mode;           // Stores read or write mode
        int seek_offset;    // How far have seeked in file
};

#endif // FILE_H
